<?php
namespace Home\Controller;
use Think\Controller;
/**
 * 公共控制器
 */
class IndexController extends HomeController {
	/**
	 * 默认首页
	 */
	public function index() {
		$keyword = I('post.keyword');
		$p = I('get.p', 1, 'intval');
		$map = array();
		$map['uid'] = $this->uid;
		$map['status'] = 1;
		if ('' != $keyword) {
			$map['title|remark'] = array('like', '%'.$keyword.'%');
		}
		$password = M('Password');
		$count = $password->where($map)->count();
		$listRows = 20;
		$list = $password->where($map)->field('id,title,create_time,create_ip,view_num')->order('id DESC')->page("$p, $listRows")->select();
		
		$page = new \Org\Util\Page($count, $listRows);
		$show = $page->show();
		
		$this->assign('list', $list);
		$this->assign('page', $show);
		$this->assign('p', $p);
		$this->assign('listRows', $listRows);
		$this->display();
	}
}